f = g_fopen (filename, "rb");
if (!f) {
+ gint save_errno = errno;
g_set_error (error,
G_FILE_ERROR,
- g_file_error_from_errno (errno),
+ g_file_error_from_errno (save_errno),
_("Failed to open file '%s': %s"),
display_name,
- g_strerror (errno));
+ g_strerror (save_errno));
g_free (display_name);
return NULL;
}
f = g_fopen (filename, "rb");
if (!f) {
+ gint save_errno = errno;
gchar *display_name = g_filename_display_name (filename);
g_set_error (error,
G_FILE_ERROR,
- g_file_error_from_errno (errno),
+ g_file_error_from_errno (save_errno),
_("Failed to open file '%s': %s"),
display_name,
- g_strerror (errno));
+ g_strerror (save_errno));
g_free (display_name);
return NULL;
}
n = fwrite (buf, 1, count, filehandle);
if (n != count) {
+ gint save_errno = errno;
g_set_error (error,
G_FILE_ERROR,
- g_file_error_from_errno (errno),
+ g_file_error_from_errno (save_errno),
_("Error writing to image file: %s"),
- g_strerror (errno));
+ g_strerror (save_errno));
return FALSE;
}
return TRUE;
goto end;
f = fdopen (fd, "wb+");
if (f == NULL) {
+ gint save_errno = errno;
g_set_error (error,
G_FILE_ERROR,
- g_file_error_from_errno (errno),
+ g_file_error_from_errno (save_errno),
_("Failed to open temporary file"));
goto end;
}
break;
}
if (ferror (f)) {
+ gint save_errno = errno;
g_set_error (error,
G_FILE_ERROR,
- g_file_error_from_errno (errno),
+ g_file_error_from_errno (save_errno),
_("Failed to read from temporary file"));
goto end;
}
f = g_fopen (filename, "wb");
if (f == NULL) {
+ gint save_errno = errno;
gchar *display_name = g_filename_display_name (filename);
g_set_error (error,
G_FILE_ERROR,
- g_file_error_from_errno (errno),
+ g_file_error_from_errno (save_errno),
_("Failed to open '%s' for writing: %s"),
display_name,
- g_strerror (errno));
+ g_strerror (save_errno));
g_free (display_name);
return FALSE;
}
}
if (fclose (f) < 0) {
+ gint save_errno = errno;
gchar *display_name = g_filename_display_name (filename);
g_set_error (error,
G_FILE_ERROR,
- g_file_error_from_errno (errno),
+ g_file_error_from_errno (save_errno),
_("Failed to close '%s' while writing image, all data may not have been saved: %s"),
display_name,
- g_strerror (errno));
+ g_strerror (save_errno));
g_free (display_name);
return FALSE;
}
#endif
retval = (fread(buffer, len, 1, context->file) != 0);
- if (!retval && ferror (context->file))
+ if (!retval && ferror (context->file)) {
+ gint save_errno = errno;
g_set_error (context->error,
G_FILE_ERROR,
- g_file_error_from_errno (errno),
- _("Failure reading GIF: %s"), strerror (errno));
+ g_file_error_from_errno (save_errno),
+ _("Failure reading GIF: %s"),
+ strerror (save_errno));
+ }
#ifdef IO_GIFDEBUG
if (len < 100) {
g_return_val_if_fail (data != NULL, FALSE);
if (fwrite (buf, sizeof (guchar), size, context->file) != size) {
+ gint save_errno = errno;
context->all_okay = FALSE;
g_set_error (error,
G_FILE_ERROR,
- g_file_error_from_errno (errno),
+ g_file_error_from_errno (save_errno),
_("Failed to write to temporary file when loading XBM image"));
return FALSE;
}
g_return_val_if_fail (data != NULL, FALSE);
if (fwrite (buf, sizeof (guchar), size, context->file) != size) {
+ gint save_errno = errno;
context->all_okay = FALSE;
g_set_error (error,
G_FILE_ERROR,
- g_file_error_from_errno (errno),
+ g_file_error_from_errno (save_errno),
_("Failed to write to temporary file when loading XPM image"));
return FALSE;
}